package entorno;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.util.ArrayList;
import javax.swing.JPanel;

@SuppressWarnings("serial")
public class Lienzo extends JPanel {

	public synchronized static void pintarjets(Graphics g, int cantidad){
		int x = 0;
		int y = 0;
		int z = 0;
		
		for(int i=0; i<listaG.size(); i++){

			x = listaG.get(i).getPosicion().getX();
			y = listaG.get(i).getPosicion().getY();
			z = listaG.get(i).getPosicion().getZ();
			z = 1+(z/10000);
			x = (x/2000)+298;
			y = -(y/2000)+298;
			
			//System.out.println("Pinta de "+listaG.get(i).getIdentificador()+" - pos: x("+x+") y("+y+")");
			

			
			g.fillOval(x, y, z, z);
			
			
			
			g.drawString(listaG.get(i).getIdentificador(), x+10, y);
		}
	}
	
	public synchronized static void setLista(ArrayList<NodoOvi> lista){
		
	listaG = lista;
		
	}
	
	private static ArrayList<NodoOvi> listaG;
	
	

	@Override
	public void paint(Graphics g) {
		super.paint(g);
		Graphics2D g2d = (Graphics2D) g;
		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
				RenderingHints.VALUE_ANTIALIAS_ON);
		g.setColor(Color.red);
		g.fillArc(250, 250, 100, 100, 0, 360);
		g.drawArc(50, 50, 500, 500, 0, 360);
		g.setColor(Color.black);
		pintarjets(g2d,10);
		
		
	}
	public static void main(String[] args){

	}

}